package bookExercise;

import java.util.HashSet;

public class A9ParadigDemo {
    public static <T> int repeatCoount(T[] t){
        int arrayLength =t.length;
        HashSet<T> set = new HashSet<>();
        for(T tmp:t){
            set.add(tmp);
        }
        return arrayLength - set.size();
    }

    public static void main(String[] args) {
        Integer[] arr ={1,1,2,3,1,5,6,1,8,8,2,4};
        String[] s ={"李","王","孙","武","赵","钱","李"};
        A9ParadigmInterface<Integer> p1=A9ParadigDemo::<Integer>repeatCoount;
        System.out.println(p1.method(arr));
        A9ParadigmInterface<String> p2 =A9ParadigDemo::<String>repeatCoount;
        System.out.println(p2.method(s));
    }
}
